#ifndef INPUT_RECEIVER_H_
#define INPUT_RECEIVER_H_

#include "PlayerEntity.h"

/*!
	This class handle all input from keyboard and mouse.
*/
class InputReceiver: virtual public IEventReceiver
{
	private :
	PlayerEntity* player__;		/**< A pointer to the player, to make it move. */
	IrrlichtDevice* iDevice__;	/**< A pointer to the irrlicht device. */

	// keyboard informations about player movement keys
	bool k_move_forward;		/**< true if player must move forward. */
	bool k_move_backward;		/**< true if player must move backward. */
	bool k_turn_left;		/**< true if player must rotate left. */
	bool k_turn_right;		/**< true if player must rotate right. */
	double m_turn;			/**< Value of angle rotation, from keyboard input. */
	double mouse_sensibility__;	/**< Value of angle rotation, from mouse input. */

	// mouse informations
	vector2df previousPosMouse__;	/**< last known value of the mouse, used only when the RMB is pressed. */
	bool RightButtonPressed__;	/**< true when the RMB is pressed (hence the name :p ). */

	/*! Prepare the player to move, according to input. */
	void update();
	/*! Just handle input from keyboard. */
	void proceedKeyboardInput(const SEvent& event);
	/*! Just handle input from mouse. */
	void proceedMouseInput(const SEvent& event);

	public :
	/*! Constructor. Initialize all pointers to 0, but the IrrlightDevice, whith is initialized according to the World. */
	InputReceiver();
	/*! Destructor. Just does nothing. */
	virtual ~InputReceiver();

	/*! Initializes the pointor to the player, for the input receiver to be able to update it. */
	void setPlayer(PlayerEntity * pl);
	/*! Just proceed Keyboard and MouseInput, then updates the player (if any). Returns false when:
		- the player__ is not null (!= 0)
		- the player's camera is active
	    This makes the free look camera to handle input events, so you can move around with it. */
	bool OnEvent(const SEvent& event);
	/*! Returns the mouse sensibility. */
	double getMouseSensibility();
	/*! Sets the mouse sensibility. */
	void setMouseSensibility(double ms);
};

#endif

